package com.atguigu.juc.locks;

/**
 * @author yfstart
 * @create 2022-06-28 17:07
 */
public class LockSyncDemo {
  Object object = new Object();
  Book book = new Book();

  public static void main(String[] args) {}

  public void m1() {
    synchronized (book) {
      System.out.println("hello synchronized code block");
      throw new RuntimeException("---exception");
    }
  }

  public synchronized void m2() {
    System.out.println("hello synchronized m2");
  }

  public static synchronized void m3() {
    System.out.println("hello static synchronized m3");
  }
}

class Book {

}